package com.auxgroup.smarthome.business.controller;

import com.auxgroup.bridge.business.inner.dto.MultiFunctionListDto;
import com.auxgroup.smarthome.business.service.inner.MultiFunctionListInnerService;
import com.auxgroup.smarthome.web.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: laiqiuhua.
 * @Date: 2017/10/17 14:06.
 */
@Api(tags = "多联机功能列表")
@RestController
@RequestMapping("/multi_function_list")
public class MultiFunctionListController {
    @Autowired
    private MultiFunctionListInnerService multiFunctionListInnerService;

    @ApiOperation(value = "添加多联机功能列表")
    @PostMapping("/add")
    public ApiResponse saveMultiFunctionList(@RequestBody MultiFunctionListDto multiFunctionListDto) {
        return multiFunctionListInnerService.saveMultiFunctionList(multiFunctionListDto);
    }

    @ApiOperation(value = "更新多联机功能列表")
    @PutMapping("/update/{id}")
    public ApiResponse updateMultiFunctionList(@PathVariable("id") String id, @RequestBody MultiFunctionListDto multiFunctionListDto) {
        return multiFunctionListInnerService.updateMultiFunctionList(id, multiFunctionListDto);
    }

    @ApiOperation(value = "删除多联机功能列表")
    @DeleteMapping("/delete/{id}")
    public ApiResponse deleteMultiFunctionList(@PathVariable("id") String id) {
        return multiFunctionListInnerService.deleteMultiFunctionList(id);
    }

    @ApiOperation(value = "获取多联机功能列表")
    @GetMapping("/list")
    public ApiResponse getMultiFunctionList() {
        return multiFunctionListInnerService.getMultiFunctionList();
    }

}
